home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / NET / IRDA / IRKBD.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  3KB  |  92 lines

  1. /*********************************************************************
  2.  *                
  3.  * Filename:      irkbd.h
  4.  * Version:       0.2
  5.  * Description:   IrDA Keyboard/Mouse driver (Tekram IR-660)
  6.  * Status:        Experimental.
  7.  * Author:        Dag Brattli <dagb@cs.uit.no>
  8.  * Created at:    Mon Mar  1 00:24:19 1999
  9.  * Modified at:   Thu Mar 11 14:54:00 1999
  10.  * Modified by:   Dag Brattli <dagb@cs.uit.no>
  11.  * 
  12.  *     Copyright (c) 1999 Dag Brattli, All Rights Reserved.
  13.  *      
  14.  *     This program is free software; you can redistribute it and/or 
  15.  *     modify it under the terms of the GNU General Public License as 
  16.  *     published by the Free Software Foundation; either version 2 of 
  17.  *     the License, or (at your option) any later version.
  18.  *  
  19.  *     Neither Dag Brattli nor University of Troms° admit liability nor
  20.  *     provide warranty for any of this software. This material is 
  21.  *     provided "AS-IS" and at no charge.
  22.  *     
  23.  ********************************************************************/
  24.  
  25. #ifndef IRKBD_H
  26. #define IRKBD_H
  27.  
  28. /* Some commands */
  29. #define IRKBD_CMD_INIT_KBD   0xfe
  30. #define IRKBD_CMD_INIT_MOUSE 0xff
  31. #define IRKBD_CMD_ENABLE     0x41
  32. #define IRKBD_CMD_LED        0x31
  33. #define IRKBD_CMD_KDB_SPEED  0x33
  34.  
  35. /* Some responses */
  36. #define IRKBD_RSP_KBDOK      0x11
  37. #define IRKBD_RSP_KBDERR     0x12
  38. #define IRKBD_RSP_MSOK       0x21
  39. #define IRKBD_RSP_MSERR      0x22
  40. #define IRKBD_RSP_LEDOK      0x31
  41. #define IRKBD_RSP_KBDSPEEDOK 0x33
  42. #define IRKBD_RSP_RSPN41     0x41
  43.  
  44. #define IRKBD_RATE       2 /* Polling rate, should be 15 ms */
  45. #define IRKBD_TIMEOUT  100 /* 1000 ms */
  46.  
  47. #define SUBFRAME_MASK     0xc0
  48. #define SUBFRAME_MOUSE    0x80
  49. #define SUBFRAME_KEYBOARD 0x40
  50. #define SUBFRAME_RESPONSE 0x00
  51.  
  52. #define IRKBD_MAX_HEADER (TTP_HEADER+LMP_HEADER+LAP_HEADER)
  53.  
  54. #define IRKBD_BUF_SIZE 4096 /* Must be power of 2! */
  55.  
  56. enum {
  57.     IRKBD_IDLE,       /* Not connected */
  58.     IRKBD_INIT_KBD,   /* Initializing keyboard */
  59.     IRKBD_INIT_MOUSE, /* Initializing mouse */
  60.     IRKBD_POLLING,    /* Polling device */
  61. };
  62.  
  63. /* Main structure */
  64. struct irkbd_cb {
  65.     struct miscdevice dev;
  66.     char devname[9];    /* name of the registered device */
  67.     int state;
  68.  
  69.     int count;          /* Open count */
  70.  
  71.     __u32 saddr;        /* my local address */
  72.     __u32 daddr;        /* peer address */
  73.  
  74.     struct tsap_cb *tsap;        
  75.     __u8 dtsap_sel;     /* remote TSAP address */
  76.     __u8 stsap_sel;     /* local TSAP address */
  77.  
  78.     struct timer_list watchdog_timer;
  79.  
  80.     LOCAL_FLOW tx_flow;
  81.     LOCAL_FLOW rx_flow;
  82.  
  83.     __u8 scancodes[IRKBD_BUF_SIZE]; /* Buffer for mouse events */
  84.     int head;
  85.     int tail;
  86.  
  87.     struct wait_queue *read_wait;
  88.     struct fasync_struct *async;
  89. };
  90.  
  91. #endif /* IRKBD_H */
  92.